package cn.iocoder.yudao.module.apijson.dal.mysql.access;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.apijson.dal.dataobject.access.AccessDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.apijson.controller.admin.access.vo.*;

/**
 * 权限配置(必须) Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface AccessMapper extends BaseMapperX<AccessDO> {

    default PageResult<AccessDO> selectPage(AccessPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AccessDO>()
                .eqIfPresent(AccessDO::getDebug, reqVO.getDebug())
                .eqIfPresent(AccessDO::getAccessSchema, reqVO.getAccessSchema())
                .likeIfPresent(AccessDO::getName, reqVO.getName())
                .eqIfPresent(AccessDO::getAlias, reqVO.getAlias())
                .eqIfPresent(AccessDO::getDetail, reqVO.getDetail())
                .orderByDesc(AccessDO::getId));
    }

}